<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="p" uri="http://primefaces.prime.com.tr/ui"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view>
	<html xmlns="http://www.w3.org/1999/xhtml"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:p="http://primefaces.prime.com.tr/ui">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><h:outputText
		value="#{message.mainHeader} - #{message.adminManageAdminsHeader}" /></title>
	<p:resources />
	<style type="text/css">
<!--
.select-menu {
	width: 200px;
	height: 300px;
	padding: 5px;
	padding-left: 1px;
	font-weight: bold;
	font-size: 12px;
	color: #223C75;
	background: #f1f1f1;
	border: 1px #666666 solid;
}

.select-menu select {
	width: 200px;
	height: 300px;
	padding: 5px;
	padding-left: 1px;
	font-weight: bold;
	font-size: 12px;
	color: #223C75;
	background: #f1f1f1;
	border: 1px #666666 solid;
}

.select-menu select option {
	padding: 3px;
}
-->
</style>
	</head>
	<body>
	<h:panelGrid columns="2">
		<h:form id="adminControlMenu">
			<h:panelGrid columns="1">
				<h:commandLink id="manageAccount">
					<h:outputLabel value="#{message.manageAccount}" />
				</h:commandLink>
				<h:commandLink id="manageAdmins">
					<h:outputLabel value="#{message.manageAdmins}" />
				</h:commandLink>
				<h:commandLink id="manageUsers">
					<h:outputLabel value="#{message.manageUsers}" />
				</h:commandLink>
				<h:commandLink id="sendMail">
					<h:outputLabel value="#{message.manageMails}" />
				</h:commandLink>
				<h:commandLink id="logout" action="#{AdminManagerBean.logOut}">
					<h:outputLabel value="#{message.logoutLabel}" />
				</h:commandLink>
			</h:panelGrid>
		</h:form>
		<h:form id="adminManagingForm">
			<p:tabView>
				<p:tab title="#{message.addNewAdmin}">
					<h:panelGroup id="addNewAdminPanel">
						<h:panelGroup
							rendered="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.success == false}">
							<h:outputText value="#{message.userNameFieldErrorMessage}"
								rendered="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.errorUsername}" />
							<br />
							<h:outputText value="#{message.passwordFieldErrorMessage}"
								rendered="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.errorPassword}" />
							<br />
							<h:outputText value="#{message.emailFieldErrorMessage}"
								rendered="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.errorEmail}" />
							<br />
							<h:outputText value="#{message.firstnameFieldErrorMessage}"
								rendered="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.errorFirstName}" />
							<br />
							<h:outputText value="#{message.lastnameFieldErrorMessage}"
								rendered="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.errorLastName}" />
							<br />
							<h:outputText value="#{message.userNameAlreadyExistsMessage}"
								rendered="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.errorUserNameExists}" />
							<br />
							<h:panelGrid columns="2">
								<h:outputLabel value="#{message.adminUserNameInputLabel}" />
								<h:inputText
									value="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.adminUserName}" />
								<h:outputLabel value="#{message.passwordInputLabel}" />
								<p:password minLength="6" maxlength="20"
									value="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.password}" />
								<h:outputLabel value="#{message.passwordInputCheckLabel}" />
								<p:password minLength="6" maxlength="20"
									value="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.passwordCheck}" />
								<h:outputLabel value="#{message.emailInputLabel}" />
								<h:inputText
									value="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.email}" />
								<h:outputLabel value="#{message.firstNameInputLabel}" />
								<h:inputText
									value="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.firstName}" />
								<h:outputLabel value="#{message.lastNameInputLabel}" />
								<h:inputText
									value="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.lastName}" />
								<h:outputLabel value="#{message.selectAnAdminGroupLabel}" />
								<h:selectOneMenu
									value="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.group}">
									<f:selectItems
										value="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.groups}" />
								</h:selectOneMenu>
								<p:commandButton value="#{message.addNewAdminGroupButtonLabel}"
									actionListener="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.addNewAdmin}"
									update="addNewAdminPanel" />
							</h:panelGrid>
						</h:panelGroup>
						<h:panelGroup
							rendered="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.success}">
							<h:panelGrid columns="1">
								<h:outputText value="#{message.addNewAdminSuccessMessage}" />
								<p:commandButton value="#{message.addAnotherAdminButton}"
									actionListener="#{AdminManagerBean.adminAdminsManager.addNewAdminManager.addAnotherAdmin}"
									update="addNewAdminPanel" />
							</h:panelGrid>
						</h:panelGroup>
					</h:panelGroup>
				</p:tab>
				<p:tab title="#{message.editAdmin}">
					<h:panelGrid columns="1">
						<h:panelGrid columns="3">
							<h:outputLabel value="Admin Adını Giriniz:" />
							<h:inputText
								value="#{AdminManagerBean.adminAdminsManager.editAdminManager.selectedAdmin}" />
							<p:commandButton value="Bul"
								actionListener="#{AdminManagerBean.adminAdminsManager.editAdminManager.findAdmin}"
								update="adminEditingPanel" />
							<p:commandButton value="Bütün Adminleri Listele" />
						</h:panelGrid>
						<h:panelGroup id="adminEditingPanel">
							<h:outputText value="Admin couldn't found"
								rendered="#{AdminManagerBean.adminAdminsManager.editAdminManager.isEditing
									&&!AdminManagerBean.adminAdminsManager.editAdminManager.adminFound}" />
							<h:panelGrid columns="2"
								rendered="#{AdminManagerBean.adminAdminsManager.editAdminManager.isEditing
									&&AdminManagerBean.adminAdminsManager.editAdminManager.adminFound}">
								<h:outputLabel value="#{message.adminUserNameInputLabel}" />
								<p:inplace>
									<h:inputText
										value="#{AdminManagerBean.adminAdminsManager.editAdminManager.editedAdminUserName}" />
								</p:inplace>
								<h:outputLabel value="#{message.passwordInputLabel}" />
								<p:inplace>
									<p:password minLength="6" maxlength="20"
										value="#{AdminManagerBean.adminAdminsManager.editAdminManager.editedPassword}" />
									<h:outputLabel value="#{message.passwordInputCheckLabel}" />
									<p:password minLength="6" maxlength="20"
										value="#{AdminManagerBean.adminAdminsManager.editAdminManager.editedPasswordCheck}" />
								</p:inplace>
								<h:outputLabel value="#{message.emailInputCheckLabel}" />
								<p:inplace>
									<h:inputText
										value="#{AdminManagerBean.adminAdminsManager.editAdminManager.editedEmail}" />
								</p:inplace>
								<h:outputLabel value="#{message.emailInputCheckLabel}" />
								<p:inplace>
									<h:inputText
										value="#{AdminManagerBean.adminAdminsManager.editAdminManager.editedFirstName}" />
								</p:inplace>
								<h:outputLabel value="#{message.lastNameInputLabel}" />
								<p:inplace>
									<h:inputText
										value="#{AdminManagerBean.adminAdminsManager.editAdminManager.editedLastName}" />
								</p:inplace>
							</h:panelGrid>
						</h:panelGroup>
					</h:panelGrid>
				</p:tab>
				<p:tab title="#{message.removeAdmin}">
					<h:panelGrid columns="1">
						<h:outputLabel value="#{message.selectGroupToRemoveLabel}" />
						<h:selectOneListbox id="removeGroupList" styleClass="select-menu"
							style="font-size:12px;">
							<f:selectItem itemLabel="group1" value="1" />
							<f:selectItem itemLabel="group2" value="2" />
						</h:selectOneListbox>
						<p:commandButton value="#{message.removeAuthorizationGroups}" />
					</h:panelGrid>
				</p:tab>
			</p:tabView>
		</h:form>
	</h:panelGrid>
	</body>
	</html>
</f:view>